<!-- layout::..:default:public_header::0 -->
<div class="main w60">
	<form action="{:U('core-logging/login')}" method="POST" class="form_login">
		<input type="hidden" value="{:$_SERVER['HTTP_REFERER']}" name="referer" />
		<h3>{%user}{%login}</h3>
		<table>
			<tr><td>{%username}</td><td><input type="text" value="" name="username" style="width:150px" /></td></tr>
			<tr><td>{%password}</td><td><input type="password" value="" name="password" style="width:150px" /></td></tr>
			<tr><td>{%seccode}</td><td>{:W('seccode')}</td></tr>
			<tr><td></td><td><br />{:gTpl::button('power', 'login', '', '$("form").submit();')} <label for="rememberme"><input id="rememberme" type="checkbox" name="rememberme" value="1" checked />{%rememberme}</label></td></tr>
		</table>
		<div class="ui-helper-hidden-accessible"><input type="submit" value="{%login}" /></div>
	</form>
	
		<script>
			//$.ajaxSetup({type:"POST"});
			$.gx.ajaxForm('.form_login', {
				cb_before:function() {
					$p = $(this).find('input[name=password]');
					if(!$p.val().match(/^\w{32}$/)) {
						$p.val($.md5($p.val())).addClass('ui-state-default').one('focus', function() {
							$(this).removeClass('ui-state-default');
						});
						var form = this;
						setTimeout(function() {
							$(form).submit();
						}, 1);
						return false;
					}
					$(this).find('.ui-button').attr('disabled', true).addClass('ui-state-disabled');
				},
				cb_success:function(rst) {
					$.gx.parseResult(rst);
					$(this).find('.ui-button').attr('disabled', null).removeClass('ui-state-disabled').end()
					.find('.seccode img').remove().end()
					.find('input:text').val('').end();
				},
				cb_error:function(xhr) {
					if(xhr.responseText) {
						var win = window.open("","","modal=1,depended=1");
						win.document.write(xhr.responseText);
					} else {
						$(this).find('.ui-button').attr('disabled', null).removeClass('ui-state-disabled').end()
						.find('.seccode img').remove().end()
						.find('input:text').val('').focus().end();
						if(!$(this).attr('_retry')) $(this).attr('_retry', true).submit();
					}
				}
			}).find('input:password').focus(function() { $(this).val(''); });
		</script>

</div>
<!-- layout::..:default:public_footer::0 -->